package com.example.lawyerdemo.dongao.service.impl;

import com.example.lawyerdemo.dongao.entity.Lawyer;
import com.example.lawyerdemo.dongao.mapper.LawyerMapper;
import com.example.lawyerdemo.dongao.service.LawyerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Classname LawyerServiceImpl
 * @Description TODO
 * @Copyright:Copyright(c) 2021
 * @Company
 * @Author zhang
 * @Version 1.0
 * @Date 2023/1/2 10:51
 */
@Service
public class LawyerServiceImpl implements LawyerService {
    @Autowired
    LawyerMapper lawyerMapper;

    /**
     * 添加律师
     *
     * @param lawyer 律师对象
     * @return 添加成功返回1，否则返回0
     */
    @Override
    public int addLawyer(Lawyer lawyer) {
        return lawyerMapper.insertLawyer(lawyer);
    }

    /**
     * 查询所有律师集合
     *
     * @return
     */
    @Override
    public List<Lawyer> findLawyer() {
        List<Lawyer> lawyerList = lawyerMapper.selectLawyer();
        return lawyerList;
    }

    /**
     * 删除
     *
     * @param lawyerid
     * @return
     */
    @Override
    public int removeLawyer(int lawyerid) {
        return lawyerMapper.deleteLawyer(lawyerid);
    }
}
